<script setup lang="ts">
    import { ref } from 'vue';
    // import Bar from './components/Bar.vue';
    // import Foo from './components/Foo.vue';

    // 组件名推断：根据文件名自动推断

    // 通过单组件引入多个组件
    import * as All from './components/index';

    const condition = ref(false);

    setTimeout( () => {
        condition.value = true;
    },2000);
</script>

<template>
    <!-- <component :is="condition ? Foo : Bar" /> -->
    <component :is="condition ? All.Foo : All.Bar" />
</template>